#include "connectdialog.h"

ConnectDialog::ConnectDialog(QWidget *parent)
	: QDialog(parent)
	, ui(new Ui::ConnectDialogClass())
{
	ui->setupUi(this);
	this->init();
}

ConnectDialog::~ConnectDialog()
{
	delete ui;
}

void ConnectDialog::init()
{
	connect(ui->connectBtn, &QPushButton::clicked, this, &ConnectDialog::onConnectBtnClicked);
	connect(ui->disconnectBtn, &QPushButton::clicked, this, &ConnectDialog::onDisconnectBtnClicked);
}

void ConnectDialog::onConnectBtnClicked()
{
	this->ip_ = ui->ipLine->text();
	this->port_ = ui->portLine->text().toInt();
	this->done(ConnectType::CONNECT);
}

void ConnectDialog::onDisconnectBtnClicked()
{
	this->done(ConnectType::DISCONNECT);
}
